const path = require('path');
const webpack = require("webpack");
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const processEnvVariable = require('./processEnvVariable.js');

module.exports = merge(common, {
  mode: 'production',
  plugins: [
    new webpack.DefinePlugin({
      'process.env': {
        ...processEnvVariable(require('dotenv').config({ path: path.resolve(__dirname, '.env..env') }).parsed)
      }
    })
  ],
  module: {
    rules: [
      {
        test: /\.ts$/,
        exclude: /node_modules/,
        loader: "babel-loader",
      },
    ]
  }
});